package com.qf.feign;

import com.qf.pojo.User;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * SearchFeign接口的兜底功能, 一旦被调用方出现异常, 那么走这里的方法,
 * 返回提示结果
 * @author 千锋健哥
 */
@Component
@RequestMapping("/fallback")
public class SearchFallBack implements SearchFeign{

    @Override
    public String hello() {
        return "search服务网络繁忙, 稍后再试";
    }

    @Override
    public User findUserById(Integer id) {
        User user = new User();
        user.setId(0);
        user.setName("网络繁忙");
        return user;
    }

    @Override
    public String insertUser(User user) {
        return "search服务网络繁忙, 稍后再试";
    }

}
